package com.rxmvp.baselibrary.base;


import com.rxmvp.baselibrary.base.mvp.IBaseView;
import com.trello.rxlifecycle2.LifecycleProvider;

/**
 * 与RxJava有关的activity的基类presenter，负责获取资源引用和释放资源引用
 *      使用RxJava的presenter需要继承此类
 *
 * 作者： huangRZ on 2017/1/21. 15:04
 * 邮箱：917647409@qq.com
 *
 * E：ActivityEvent  或者  FragmentEvent
 */
public class RxBasePresenter<T extends IBaseView, E> {

    protected LifecycleProvider<E> mLifecycleProvider;
    protected T mView;
    protected RxHelper<E> mRxHelper;

    //构造器中的参数实例由其子类构造器提供，其子类的参数实例由dagger中的module提供
    public RxBasePresenter(IBaseView view, LifecycleProvider<E> activityLifecycleProvider, RxHelper<E> rxHelper){
        this.mView = (T) view;
        this.mLifecycleProvider = activityLifecycleProvider;
        this.mRxHelper = rxHelper;

    }

    public void onDestroy(){
        mView = null;
        mLifecycleProvider = null;
    }
}
